from typing import *

class Solution:
    def maxArrayValue(self, nums: List[int]) -> int:
        t = ans = 0
        for i in range(len(nums) -1 ,-1,-1):
            t = t + nums[i] if t >= nums[i] else nums[i]
            ans = max(ans,t)
        return ans